<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');

need_manager();

if ( $_POST ) {
	$table = new Table('user', $_POST);
	$table->create_time = time();
	$table->password = ZUser::GenPassword($table->password);
	$table->city_id = abs(intval($auth_info['city_id']));
	$table->proxy_id = abs(intval($login_user['proxy_id']));
	$table->manager = 'Y';
	$table->proxy = 'Y';
	$table->insert(array(
		'username', 'city_id', 'create_time', 'email', 'realname',
		'password', 'proxy_id', 'proxy', 'manager', 
	));
	redirect( WEB_ROOT . '/manage/user/manager.php');
}

include template('manage_user_create');
